package tms.ui;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.layout.GridData;

/**
 * About displays information about the TMS
 * 
 * @author Rolf Schmidt
 * @version 1.0
 */
public class About extends Dialog {

	/**
	 * Create the dialog.
	 * 
	 * @param parentShell the shell in which the dialog will be executed
	 */
	public About(Shell parentShell) {
		super(parentShell);
	}

	/**
	 * Create contents of the dialog.
	 * 
	 * @param parent the parent composite object
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		GridLayout gridLayout = (GridLayout) container.getLayout();
		gridLayout.numColumns = 5;
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		
		// setup images
		Label lblNewLabelImage = new Label(container, SWT.NONE);
		lblNewLabelImage.setImage(SWTResourceManager.getImage(About.class, "/images/calendar-blue-big.png"));
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		
		// add project information
		Label lblTaskManagementSystem_1 = new Label(container, SWT.NONE);
		lblTaskManagementSystem_1.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.BOLD));
		lblTaskManagementSystem_1.setText("Task Management System (COMP5541)");
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		
		// add developers information
		Label lblTaskManagementSystem = new Label(container, SWT.NONE);
		lblTaskManagementSystem.setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.ITALIC));
		lblTaskManagementSystem.setAlignment(SWT.CENTER);
		lblTaskManagementSystem.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
		lblTaskManagementSystem.setText("Amer Alhalabi, Dmitriy Fingerman, Zoardar Golam\r\nRajwinder Kaur, Rolf Schmidt, 2012");
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		
		Label lblNewLabelIcons = new Label(container, SWT.NONE);
		lblNewLabelIcons.setText("Some icons by Yusuke Kamiyamane.\r\nhttp://p.yusukekamiyamane.com/\r\nAll rights reserved.\r\nLicensed under a Creative Commons Attribution 3.0 License.\r\n\r\nhttp://creativecommons.org/licenses/by/3.0/");

		return container;
	}

	/**
	 * Create contents of the button bar.
	 * @param parent the composite parent object
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
				true);
	}

	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(467, 338);
	}

}
